======================================================================== FIRSTLIB.MDA ======================================================================== ABOUT FIRSTLIB -------------- FIRSTLIB is a Microsoft Access library database designed to make designing databases a little easier. The tools provided in the database are design-oriented in that they help you to create new forms, menus, modules, and procedures. Like other library databases, FIRSTLIB can be invoked from any database you're currently working on. An Autokeys macro is included that you can import into your databases. Once this macro has been imported, if you have FIRSTLIB.MDA correctly installed, you are a keystroke away from the tools provided. DISCLAIMER ---------- FIRSTLIB.MDA is provided "as-is" without warranty of any kind, either expressed or implied, including byt not limited to the warranties of merchantibility and/or fitness for a particular purpose. The user assumes the entire risk as to the accuracy and the use of this Microsoft Access Library Database. FIRSTLIB.MDA may be freely copied and distributed subject to the following conditions: 1) This document must accompany FIRSTLIB.MDA; 2) FIRSTLIB.MDA should not be modified in any way; 3) FIRSTLIB.MDA may not be distributed for profit. INSTALLATION ------------ To install FIRSTLIB.MDA, open MSACCESS.INI in the Windows directory, and add the following option: [Libraries] C:\MYDIR\FIRSTLIB.MDA=ro Also, FIRSTLIB.MDA requires the following special entry in the same .INI file: [MenuBuilder] Path=C:\MYDIR\FIRSTLIB.MDA You must exit and restart Access for the change to take effect. WHAT'S INCLUDED --------------- There are four main tools that FIRSTLIB provides: A Form Design tools library, a Macro to Module converter, an expanded New Procedure dialog for writing Access Basic Code, and an automatic custom menu builder. Each of these four tools can be accessed by running a function in the Immediate Window, or by pressing a key if you have imported the Autokeys macro. The table below shows how to invoke each of the tools. TOOL FUNCTION NAME KEYSTROKE --------- ------------------ ----------------------- Form Design Tool Palette flib_OpenFDTools Shift-F12 Macro to Module Coverter flib_ConvertMacros Ctrl-F12 Extended New Procedure Dialog flib_NewProc F12 Menu Builder BuilderFormOnMenu Shift-F2 in OnMenu Prop So, if you want to convert macros to modules, you can go to the Immediate Window and type: ? flib_ConvertMacros() or simply hit Ctrl-F12 if you have the Autokeys macro loaded. (Note that the Extended New Procedure Dialog is only applicable in a module, so you must have a module active for this function to work.) THE TOOL PALETTE ---------------- FD Tools is a collection of form design tools that can be used with any form. At present, these tools cannot be used with reports, but this should change soon. The tool palette contains 2 rows of 6 tools. Each has a nifty little icon, but I can't show those here (since this is a text file). Instead, I will reference each tool by its row and column, in the format R1C1, R1C2, etc. R1C1: Sunken Frame ------------------ This tool will put a sunken rectangle behind *any* control, including subforms, listboxes, dropdowns, etc. If you change the size of the control, and then click the Sunken Frame button again, FIRSTLIB will find any existing frame and simply resize it. FIRSTLIB finds existing rectangles by first looking at the control name for all rectangles on the form. If the control name is of the pattern "FieldNameFrame" and you are trying to frame "FieldName," then "FieldNameFrame" will be resized. If no rectangle is found with the correct name, FIRSTLIB will look for a rectangle that is overlapping the control in question. If this search returns no rectangles, then a new frame is created. R1C2: Shadow Frame ------------------ This tool follows the same rules as the Sunken Frame tool above, but it creates a frame that looks like a shadow, very similar to the Wizard Shadow style. You can easily switch an exisitng Sunken Frame to a Shadow Frame and vice versa. R1C3: Size Object ----------------- This tool brings up the dimensions for an object in TWIPS. On this dialog you can change, Top, Bottom, Left, Right, Height, and Width. In the future, I plan to make the measurement settable, so you could specify dimensions in twips, inches, and/or centimeters. R1C4: Make Controls Same Size ----------------------------- Clicking this button will bring up a list of all the controls on the active form. You can then select the controls that you wish to apply this operation to. Next, simply specify the new height and width for all of the selected controls and click OK. The controls will be resized to the same height and width. If you leave the height or width field blank, it will be ignored when sizing the controls. NOTE: The Unit of Measurement option group has no effect. All measurements are still in TWIPS. R1C5: Vertical Alignment Tool ----------------------------- This tool works much like R1C4 in that a list of controls is brought up and you are allowed to select the controls you wish to apply the operation to. The vertical alignment tool will take each control you selected, in the order that you selected them, and space them evenly on the form according to the spacing you have specified. NOTE: There is currently a bug here in that the controls you have selected are not sorted by the time that they were selected. I will fix this soon. R1C6: Horizontal Alignment Tool ------------------------------- Same as the Vertical Alignment Tool only horizontal. Great for simulating datasheets in form view. R2C1-R2C4: Alignment Tools -------------------------- These four tools are essentially short cuts for the menu options Align Left, Align Right, Align Top and Align Bottom. R2C5-R2C6: Bring To Front / Send To Back ---------------------------------------- Another group of short cut buttons for another group of commonly used menu options. MACRO TO MODULE CONVERTER ------------------------- When you invoke the Macro to Module Converter, a dialog will appear that lists all the Macros in the current database. After selecting a Macro to convert, you must provide a valid file name. FIRSTLIB will write the Basic equivalent to the macro directly to this file. Once complete, simply load the file into a module as text, and you're ready to go (almost, see below). All of the conditions that you specified in the Macro will be converted to "If" statements, and support for "..." is included. Certain Actions will be converted to the ABC equivalent (like MsgBox), and others will not be included at all (like AddMenu), but the majority of actions will be converted to the "DoCmd Action" format. The dialog provides two options that control the format of the code that is generated. The first option, Include Error Handling Code, will automagically add the appropriate 'On Error' type stuff if it is checked. If an error occurs, a MsgBox will give a description of the problem. The second option, Include Function Names in Error Dialogs, is only applicable if the first option is checked. If selected, this second option will place the title of the function in the title of the MsgBox that is shown when an error occurs. EXTENDED NEW PROCEDURE DIALOG ----------------------------- When writing basic code, you can quickly add a new procedure by choosing [Edit] [New Procedure] from the menu. Unfortunately, this option provides relatively simple procedure creation functionality. The Extended New Procedure dialog allows you to specify not only the name and type of the procedure to add, but also the return value (if the procedure is a function) and comments (if you wish). Furthermore, FIRSTLIB can also automatically generate error handling code as described in the previous section. Once you've described the function that you wish to create, click the OK button and the function will be created in the currently active module. Note that FIRSTLIB uses SendKeys to create the function, so if you provide a duplicate function name, disaster could be the result. For the most part however, functions should be added quickly and cleanly. MENU BUILDER ------------ The custom Menu Builder can be invoked from any form in design view by simply moving to the property window, placing the cursor in the OnMenu property, and pressing Shift-F2. A dialog will appear that looks much like Visual Basic's menu dialog. This dialog allows you to define both top level and sub menu items. The upper half of the dialog contains the criteria for the currently selected menu item. The lower half is a list of all the menu items in the current menu bar. A menu item can either be a top level item, meaning that it is shown in the main Access menu bar, or a sub menu item, which means that it can be selected from one of the pop-up menus. By default all items are top-level. To make an item a pop-up menu item, select the item in the list and click the -> arrow button. An elipsis (...) should appear to the left of the item in the listbox, and the Action and Argument fields should become enabled in the top half of the dialog. When you are finished building your menu, simply click Save. (If you have not yet saved the menu, you will be prompted for a filename.) The Macros that make up the menu bar will be automatically created for you. Later, if you want to edit the menu bar again, make sure you do so by pressing Shift-F2 in the same OnMenu property. This will ensure that the macros are always saved in a format that is readable by the builder. Never edit the Macros directly. QUESTIONS/COMMENTS ------------------ If you have questions or comments about FIRSTLIB, please contact me directly through EMail: andrewm@microsoft.com.